import requests

# 从代理服务中获取一个代理IP
proxy =  requests.get("http://api.xdaili.cn/xdaili-api//greatRecharge/getGreatIp?spiderId=3993963779ca4218b6d7e32683b5b337&orderno=YZ20193218831z1SscU&returnType=1&count=1").text.strip()
proxies = {
    'http': 'http://' + proxy,
    'https': 'https://' + proxy,
}
print(proxy)
try:
    response = requests.get('https://www.baidu.com', proxies=proxies)
    print('aaaa')
    #print(response.url)
except requests.exceptions.ConnectionError as e:
    print('Error', e.args)